<template>
  <div class="other-operation">
    <div class="other-operation-item" @click="toPerson('User')">
      个人中心
    </div>
    <div class="other-operation-item" @click="toPerson('MyQuest')">
      我的提问
    </div>
    <div class="other-operation-item" @click="toPerson('MyFavorite')">
      我的收藏
    </div>
    <div class="other-operation-item" @click="logout">
    退出登录
    </div>
  </div>
</template>

<script>
  export default {
    data () {
      return {
        LoginForm: {
          email: '',
          password: '',
        },
        logining: false,
      }
    },
    methods: {
      logout: function() {
        this.$confirm("确认退出吗?", "提示", {
          type: "warning"
        })
          .then(() => {
            sessionStorage.removeItem("user")
            this.$api.login.logout().then(() => {
              sessionStorage.removeItem("user")
              this.$store.state.isLogin = false;
              this.$router.push('/');
            }).catch(function(res) {
            })
          })
          .catch(() => {})
      },
      toPerson(num) {
        this.$store.state.activeIndex = num;
        sessionStorage.setItem('activeIndex',num);
        // this.$router.push('/UserMain')
        this.$router.push({
          name:"UserMain",
          params: {
            data : num
          }
        });
      }
    }
  }
</script>

<style scoped lang="scss">
  .other-operation {
    width: 150px;
    height: 200px;

  }
  .other-operation-item {
    text-align: center;
    color: #3B5356;
    font-size: 16px;
    width: 150px;
    height: 43px;
    padding-top: 10px;

  }
  .other-operation-item:hover {
    cursor: pointer;
    background: #9e94941e;
    color: rgb(19, 138, 156);
  }

</style>
